#!/bin/bash

count=0
while [ 1 ];do
	ping -c 1 -W 2 114.114.114.114 2>&1 >/dev/null
	if [ $? != 0 ];then
		echo "ping failed"
		count=$((count + 1))
		if [ $count -gt 5 ];then
			echo "reboot"
			count=0
			reboot
		fi
		sleep 10
	else
		echo "ping success"
		count=0
		sleep 10
	fi
done
